package cn.xopencode.userservice.rpc;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.userservice.rpc.matter.MatterRpc;
import cn.xopencode.userservice.rpc.matter.dto.CreateMatterDTO;
import cn.xopencode.userservice.rpc.matter.dto.MatterDTO;
import cn.xopencode.userservice.rpc.matter.dto.MatterPageDTO;
import cn.xopencode.userservice.rpc.matter.dto.UpdateMatterDTO;
import cn.xopencode.userservice.service.MatterService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Author xiaodawei
 * @since 2021/9/22
 */
@DubboService(version = "${dubbo.provider.MatterRpc.version}", validation = "false")
public class MatterRpcImpl implements MatterRpc {


    @Autowired
    private MatterService matterService;


    @Override
    public CommonResult<MatterDTO> getMatter(String matterId) {
        return CommonResult.success(matterService.getMatter(matterId));
    }

    @Override
    public CommonResult<String> createMatter(CreateMatterDTO createMatterDTO) {
        return CommonResult.success(matterService.CreateMatter(createMatterDTO));
    }

    @Override
    public CommonResult<PageResult<MatterDTO>> findMatterList(MatterPageDTO matterPageDTO) {
        return CommonResult.success(matterService.findMatterList(matterPageDTO));
    }

    @Override
    public CommonResult<Integer> updateMatter(List<UpdateMatterDTO> updateMatterDTOList) {
        return CommonResult.success(matterService.updateMatter(updateMatterDTOList));
    }
}
